package com.lanlian.cayman.adapter;

import android.app.Activity;
import android.content.Context;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;


import com.lanlian.cayman.R;
import com.lanlian.cayman.bean.GearBean;

import java.util.List;

/**
 * 交易适配器
 */
public class GearAdapter extends MBaseAdapter{

	private Context context;
	//private ArrayList<getXiangMuXinXi> list;

	public GearAdapter(Context context){
		this.context=context;

	}
	public GearAdapter(Context context,List list){
		this.context=context;
		this.list=list;
	}


	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}



	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		final GearBean cj=(GearBean) list.get(position);
		Holder holder =null;
		Activity act=(Activity) context;
		if(convertView==null){
			convertView= LayoutInflater.from(context).inflate(R.layout.fragment_gear_item, null);
			holder=new Holder();
//			holder.tv_id=(TextView) convertView.findViewById(R.id.tv_id);
//			holder.tv_buy=(TextView) convertView.findViewById(R.id.tv_buy);
//			holder.tv_sell=(TextView) convertView.findViewById(R.id.tv_sell);
//			holder.tv_id.setText(cj.id);
//			holder.tv_buy.setText(cj.buy+"("+cj.buy_num+")");
//			holder.tv_sell.setText(cj.sell+"("+cj.sell_num+")");
			if(position%2==0)
			{
				convertView.setBackgroundColor(0xffF1F5F9);
			}

			convertView.setTag(holder);
		}else{
			holder=(Holder) convertView.getTag();
		}	

		
		return convertView;
	}
	
	class Holder{
		TextView tv_id;
		TextView tv_buy;
		TextView tv_sell;
	}
	
	
}
